﻿Public Class Hindi_Editor

    Public Const DocURL As String = "E:/Project SimpleCMS/Content/MainPageContent.xml"

    Private _killAutoEvent As Boolean
    Public Property KillAutoEvent() As Boolean
        Get
            If _killAutoEvent = True Then
                _killAutoEvent = False
                Return True
            End If
            'Return _killAutoEvent()
        End Get
        Set(ByVal value As Boolean)
            _killAutoEvent = value
        End Set
    End Property


    Private Sub Hindi_Editor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        CreateHindiBox()

        Select Case Me.Tag
            Case "RightTopHeading"

            Case 2 '

            Case Else

        End Select

        'If Me.Tag = "RightTopHeading" Then

        ' End If
    End Sub


    Public Sub CreateHindiBox()
        WebBrowserHindi.Navigate("E:/Project SimpleCMS/Content/hindi.html")
        WebBrowserHindi.ObjectForScripting = New ScriptManager(Me)
        Dim o(1) As Object ' = New Object(1)
        o(0) = "Hi from jscript"
        Dim result As Object = Me.WebBrowserHindi.Document.InvokeScript("CreateCustomHindiTextArea", o)
    End Sub


    '[ComVisible(true)]
    <Runtime.InteropServices.ComVisible(True)> _
    Public Class ScriptManager

        Dim _form As Hindi_Editor
        Public Sub New(ByVal form As Hindi_Editor)

            _form = form
        End Sub
        Public Sub ShowMessage(ByVal obj As Object)
            MessageBox.Show(obj.ToString())
        End Sub
    End Class

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub

    Private Sub EnglishTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnglishTextBox.TextChanged
       
    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If KillAutoEvent Then Exit Sub
        Dim textboxhindi As HtmlElement = WebBrowserHindi.Document.GetElementById("id 1")
        EnglishTextBox.Text = textboxhindi.InnerText
        textboxhindi.Enabled = False
        EnglishTextBox.Enabled = True
        KillAutoEvent = True
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If KillAutoEvent Then Exit Sub
        Dim textboxhindi As HtmlElement = WebBrowserHindi.Document.GetElementById("id 1")
        textboxhindi.Enabled = True
        textboxhindi.InnerText = EnglishTextBox.Text
        EnglishTextBox.Enabled = False
        KillAutoEvent = True
    End Sub

   
End Class